{include file="admin/header.html} 
<script type="text/javascript" src="/js/fancybox/jquery.mousewheel.js"></script>
<script type="text/javascript" src="/js/fancybox/jquery.fancybox.js"></script>
<link rel="stylesheet" type="text/css" href="/js/fancybox/jquery.fancybox.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/js/uploadify/uploadify.css">
<script type="text/javascript" src="/js/uploadify/jquery.uploadify.js"></script>
<div class="title">
    <h3>相册管理-{$album.name}</h3>
</div>
<div class="condition">
    <input type="file" name="imgFile" id="imgFile"/>
</div>
<div class="table_zone">
    {foreach from=$photos item=v}
    <div class="album">
        <a href="{$v.path}" title="{$v.describe}" rel="canshow">
            <img src="{$v.thumb}" width="135" height="120"></a>
        <a data-photoid="{$v.photoid}" title="点击编辑" href="javascript:;" class="photodesc">{if empty($v.describe)}[空]{else}{$v.describe}{/if}</a>
        <a href="javascript:;">删除</a>
    </div>
    {/foreach}
    <div class="clear"></div>
    <div class="paging">{$paging}</div>
</div>
<script>
    var albumid = {$album.albumid};
    var sessionid = '{$sessionid}';
    {literal}
    $(document).ready(function(){
        $(".photodesc").click(function(){
            t = $(this);
            photoid = t.attr("data-photoid");
            ov  = t.html();
            if(ov == '[空]')
                ov = '';
            t.html("<input type='text'/>").find("input").val(ov).focus().focusout(function(){
                nv = $(this).val();
                $.get("/admin/modphoto?photoid="+photoid+"&describe="+nv, function(){
                    t.siblings("[rel='canshow']").attr("title",nv);
                    if(nv == ''){
                        t.html('[空]')
                    }else{
                        t.html(nv);
                    }
                })
            }).click(function(e){
                e.stopPropagation();
            })
        })
        
        $("a[rel='canshow']").fancybox({
            'transitionIn'		: 'none',
            'transitionOut'		: 'none',
            'titlePosition' 	: 'over',
            'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over" style="font-family:Microsoft YaHei"> ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
        });
        $("#imgFile").uploadify({
            'height':20,
            'width':80,
            'buttonText':'添加照片',
            'fileObjName':'imgFile',
            'fileTypeDesc' : 'Image Files',
            'fileTypeExts' : '*.gif; *.jpg; *.png; *.jpeg; *.bmp',
            'formData'      : {'action' : 'albumphoto', 'albumid' : albumid, 'PHPSESSID':sessionid},
            'swf'      : '/js/uploadify/uploadify.swf',
            'uploader' : '/ajax/uploadimg',
            'method'   : 'post',
            'onUploadSuccess' : function(file, data, response) {
                //$("p").html(file+"|||"+data+"|||"+response);
            },
            'onQueueComplete' : function(queueData) {
                document.location.reload();
            }
            // Your options here
        });
    })
</script>
{/literal}
{include file="admin/footer.html"}